<extend name="Public/base"/>

<block name="body">
  <div class="main-title">
    <h2><notempty name="uid">{$uid|get_nickname}_</notempty>用户预存款充值记录({$_total})</h2>
  </div>

  <!-- 按钮工具栏 -->
  <div class="cf">
    <div class="fl">
      <a class="btn" href="{:U('')}">刷 新</a>（点击"刷新"按钮清除搜索条件，显示全部信息。）
    </div>
    
    <!-- 高级搜索 -->
    <div class="search-form fr cf">
      <div class="fl">
        <select id="mode" name="mode">
          <option value="">充值方式</option>
          <volist name="mode_config" id="vo">
            <option value="{$key}">{$vo}</option>
          </volist>
        </select>
      </div>
      <div class="sleft">
        <input type="text" name="keywords" class="search-input w-260" value="{:I('keywords')}" placeholder="请输入流水号或交易号">
        <a class="sch-btn" href="javascript:;" id="search" url="{:U()}"><i class="btn-search"></i></a>
      </div>
    </div>
  </div>
  
  <!-- 数据表格 -->
  <div class="data-table table-striped">
    <form class="ids">
      <table>
        <thead>
          <tr>
            <th class="row-selected"> <input class="checkbox check-all" type="checkbox"></th>
            <th>流水号（本系统生成）</th>
            <th>交易号（第三方支付返回）</th>
            <th>充值方式</th>
            <th>充值金额</th>
            <th>充值时间</th>
            <th>充值用户</th>
          </tr>
        </thead>
        <tbody>
          <notempty name="list">
          <volist name="list" id="vo">
            <tr>
              <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$vo.id}"></td>
              <td>{$vo.flowid}</td>
              <td>{$vo.number}</td>
              <td>{$mode_config[$vo['mode']]}</td>
              <td>{$vo.amount}</td>
              <td>{$vo.create_time|time_format}</td>
              <td><a href="{:U('User/view', array('id' => $vo['uid']))}">{$vo.uid|get_nickname}</a></td>
            </tr>
          </volist>
          <else/>
            <tr><td colspan="10" class="text-center"> 暂无充值记录! </td></tr>
          </notempty>
        </tbody>
      </table>
    </form>
    <!-- 分页 -->
    <div class="page">{$_page}</div>
  </div>
</block>

<block name="script"> 
  <script type="text/javascript">
    $(function(){
      //搜索功能
      $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();

        var mode = $("#mode").val();

        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');

        if(mode != ''){
          query += '&mode=' + mode;
        }

        if(url.indexOf('?')>0){
          url += '&' + query;
        }else{
          url += '?' + query;
        }

        window.location.href = url;
      });

      //回车自动提交
      $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
          $("#search").click();
        }
      });

      //设置单选，复选，下拉菜单的值
      Core.setValue('mode', '{$mode|default = ""}');
    });
  </script> 
</block>
